<script lang="jsx" setup>
import { computed, ref } from 'vue';
import dayjs from 'dayjs';
import { get } from '@/service/api/api';
const commonSearchRef = ref(null);
const searchParams = ref({
  startTime: null,
  endTime: null,
  id: null,
  hasPnl: null
});
const selectIndexInTraceData = ref([]);
function getselectIndexInTrace() {
  get('eap/KbEapData/selectIndexInTrace2').then(res => {
    res.data.forEach(item => {
      selectIndexInTraceData.value.push({
        value: item.id
      });
      searchParams.value.id = selectIndexInTraceData.value[0].value;
      search();
    });
  });
}
getselectIndexInTrace();
const searchFormList = [
  {
    type: 'input',
    key: 'moduleNo',
    label: '生产型号',
    placeholder: '请输入生产型号',
    span: 24,
    md: 12,
    lg: 10,
    xl: 8,
    xxl: 6,
    showTime: true
  },
  {
    type: 'input',
    key: 'lotId',
    label: '批次号',
    placeholder: '请输入批次号',
    span: 24,
    md: 12,
    lg: 10,
    xl: 8,
    xxl: 6,
    showTime: true
  },
  {
    type: 'select',
    key: 'hasPnl',
    label: '是否有码',
    placeholder: '请选择是否有码',
    span: 24,
    md: 12,
    lg: 8,
    xl: 8,
    xxl: 6,
    selectOptions: [
      {
        label: '有码',
        value: 1
      },
      {
        label: '无码',
        value: 2
      }
    ]
  },
  {
    type: 'input',
    key: 'pnlId',
    label: ' PNL码',
    placeholder: '请输入PNL码',
    span: 24,
    md: 12,
    lg: 10,
    xl: 8,
    xxl: 6,
    showTime: true
  },

  {
    type: 'dateRangePicker',
    key: 'time',
    label: '日　　期',
    span: 24,
    md: 12,
    lg: 10,
    xl: 8,
    xxl: 6,
    showTime: true
  }
];
const searchData = computed(() => {
  const params = {
    ...searchParams.value
  };
  if (searchParams.value?.time?.[0]) {
    params.startTime = dayjs(searchParams.value.time[0]).format('YYYY-MM-DD HH:mm:ss');
    params.endTime = dayjs(searchParams.value.time[1]).format('YYYY-MM-DD HH:mm:ss');
  }
  delete params.time;
  return params;
});
const column = [
  {
    key: 'dataIndex',
    dataIndex: 'dataIndex',
    title: '序号',
    fixed: 'left',
    width: 70,
    align: 'center',
    checked: true,
    ellipsis: true
  },

  {
    key: 'moduleNo',
    dataIndex: 'moduleNo',
    title: '生产型号',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true,
    fixed: 'left'
  },
  {
    key: 'lotId',
    dataIndex: 'lotId',
    title: ' 批次号',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true,
    fixed: 'left'
  },
  {
    key: 'pnlId',
    dataIndex: 'pnlId',
    title: ' PNL码',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true,
    fixed: 'left'
  },
  {
    key: 'readCodeTime',
    dataIndex: 'readCodeTime',
    title: ' 进站时间',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true,
    fixed: 'left'
  },

  {
    key: 'mainEqpId',
    dataIndex: 'mainEqpId',
    title: '设备编号',
    align: 'center',
    width: 140,
    checked: true,
    ellipsis: true,
    fixed: 'left'
  },
  {
    key: 'itemName1',
    dataIndex: 'itemName1',
    title: '批次产量累积',
    width: 140,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName2',
    dataIndex: 'itemName2',
    title: '总产量累积',
    align: 'center',
    width: 140,
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName3',
    dataIndex: 'itemName3',
    title: '开机时间累积',
    align: 'center',
    width: 130,
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName4',
    dataIndex: 'itemName4',
    title: '运行时间累积',
    width: 130,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName5',
    dataIndex: 'itemName5',
    title: '喷砂1喷淋泵工作时间累积',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName6',
    dataIndex: 'itemName6',
    title: '喷砂2喷淋泵工作时间累积',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName7',
    dataIndex: 'itemName7',
    title: '喷砂2喷淋泵工作时间累积',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName8',
    dataIndex: 'itemName8',
    title: 'DI水用量累积',
    width: 130,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName9',
    dataIndex: 'itemName9',
    title: '用电量累积',
    align: 'center',
    checked: true,
    width: 130,
    ellipsis: true
  },
  {
    key: 'itemName10',
    dataIndex: 'itemName10',
    title: '输送速度(研磨段)_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName11',
    dataIndex: 'itemName11',
    title: '输送速度(水洗,喷砂段)_实时值',
    width: 220,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName12',
    dataIndex: 'itemName12',
    title: '输送速度(干板)_实时值',
    width: 170,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName13',
    dataIndex: 'itemName13',
    title: '输送速度(研磨段)_设置值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName14',
    dataIndex: 'itemName14',
    title: '输送速度(水洗,喷砂段)_设置值',
    width: 220,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName15',
    dataIndex: 'itemName15',
    title: '输送速度(干板)_设置值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName16',
    dataIndex: 'itemName16',
    title: '酸洗/除油温度_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName17',
    dataIndex: 'itemName5',
    title: '热风吹干1温度_实时值',
    align: 'center',
    width: 180,
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName18',
    dataIndex: 'itemName18',
    title: '热风吹干2温度_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName19',
    dataIndex: 'itemName19',
    title: '酸洗/除油温度_设置值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName20',
    dataIndex: 'itemName20',
    title: '热风吹干1温度_设置值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName21',
    dataIndex: 'itemName21',
    title: '热风吹干2温度_设置值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName22',
    dataIndex: 'itemName22',
    title: '酸洗/除油频率_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName23',
    dataIndex: 'itemName23',
    title: '喷砂2冲洗频率_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName24',
    dataIndex: 'itemName24',
    title: '喷砂1分离频率_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName25',
    dataIndex: 'itemName25',
    title: '喷砂2分离频率_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName26',
    dataIndex: 'itemName26',
    width: 220,
    title: '喷砂1沉淀缸分离频率_实时值',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName27',
    dataIndex: 'itemName27',
    width: 220,
    title: '喷砂2沉淀缸分离频率_实时值',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName28',
    dataIndex: 'itemName28',
    title: '喷砂2暂存缸分离频率_实时值',
    width: 220,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName29',
    dataIndex: 'itemName29',
    title: '喷砂1喷淋泵工作时间累积',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName30',
    dataIndex: 'itemName30',
    title: '加压水洗2频率_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName31',
    dataIndex: 'itemName31',
    title: '超声波浸洗频率_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName32',
    dataIndex: 'itemName32',
    title: '加压水洗3频率_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName33',
    dataIndex: 'itemName33',
    width: 180,
    title: '强风吹干1频率_实时值',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName34',
    dataIndex: 'itemName34',
    title: '强风吹干2频率_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName35',
    dataIndex: 'itemName35',
    title: '酸洗/除油频率_设置值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName36',
    dataIndex: 'itemName36',
    width: 180,
    title: '喷砂2冲洗频率_设置值',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName37',
    dataIndex: 'itemName37',
    width: 180,
    title: '喷砂1分离频率_设置值',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName38',
    dataIndex: 'itemName38',
    width: 180,
    title: '喷砂2分离频率_设置值',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName39',
    dataIndex: 'itemName39',
    title: '喷砂1沉淀缸分离频率_设置值',
    width: 220,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName40',
    dataIndex: 'itemName40',
    title: '喷砂2沉淀缸分离频率_设置值',
    width: 230,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName41',
    dataIndex: 'itemName41',
    title: '喷砂2暂存缸分离频率_设置值',
    width: 230,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName42',
    dataIndex: 'itemName42',
    title: '加压水洗1频率_设置值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName43',
    dataIndex: 'itemName43',
    title: '加压水洗2频率_设置值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName44',
    dataIndex: 'itemName44',
    title: '超声波浸洗频率_设置值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName45',
    dataIndex: 'itemName45',
    title: '加压水洗3频率_设置值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName46',
    dataIndex: 'itemName46',
    title: '强风吹干1频率_设置值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName47',
    dataIndex: 'itemName47',
    title: '强风吹干2频率_设置值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName48',
    dataIndex: 'itemName48',
    title: '酸洗/除油上喷淋压力_实时值',
    width: 200,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName49',
    dataIndex: 'itemName49',
    title: '酸洗/除油下喷淋压力_实时值',
    width: 200,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName50',
    dataIndex: 'itemName50',
    title: '强风吹干1(1)压力_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName51',
    dataIndex: 'itemName51',
    title: '强风吹干1(2)压力_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName52',
    dataIndex: 'itemName52',
    title: '强风吹干2(1)压力_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName53',
    dataIndex: 'itemName53',
    title: '强风吹干2(2)压力_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName54',
    dataIndex: 'itemName54',
    title: '加压水洗3导电率_实时值',
    width: 180,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName55',
    dataIndex: 'itemName55',
    title: '喷砂1上压力_实时值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName56',
    dataIndex: 'itemName56',
    title: '喷砂1下压力_实时值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName57',
    dataIndex: 'itemName57',
    title: '喷砂2上压力_实时值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName58',
    dataIndex: 'itemName58',
    title: '喷砂2下压力_实时值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName59',
    dataIndex: 'itemName59',
    title: '喷砂1上压力_设置值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName60',
    dataIndex: 'itemName60',
    title: '喷砂1下压力_设置值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName61',
    dataIndex: 'itemName61',
    title: '喷砂2上压力_设置值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName62',
    dataIndex: 'itemName62',
    title: '喷砂2下压力_设置值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName63',
    dataIndex: 'itemName63',
    title: '超声波控制1_实时值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName64',
    dataIndex: 'itemName64',
    title: '超声波控制2_实时值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName65',
    dataIndex: 'itemName65',
    title: '超声波控制3_实时值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName66',
    dataIndex: 'itemName66',
    title: '超声波控制4_实时值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName67',
    dataIndex: 'itemName67',
    title: '超声波控制5_实时值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName68',
    dataIndex: 'itemName68',
    title: '超声波控制6_实时值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName69',
    dataIndex: 'itemName69',
    title: '超声波控制1_设置值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName70',
    dataIndex: 'itemName70',
    title: '超声波控制2_设置值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName71',
    dataIndex: 'itemName71',
    title: '超声波控制3_设置值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName72',
    dataIndex: 'itemName72',
    title: '超声波控制4_设置值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName73',
    dataIndex: 'itemName73',
    title: '超声波控制5_设置值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName74',
    dataIndex: 'itemName74',
    title: '超声波控制6_设置值',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'dateTime',
    dataIndex: 'dateTime',
    title: '创建时间',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  }
];
const tableRef = ref(null);
function search() {
  tableRef.value.getData();
}
function reset() {
  searchParams.value.endTime = null;
  searchParams.value.hasPnl = null;
  search();
}
</script>

<template>
  <div
    class="get-browning-line-config-page h-full min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto"
  >
    <CommonSearch
      ref="commonSearchRef"
      v-model:searchParams="searchParams"
      :form-list="searchFormList"
      :is-search="true"
      @search="search"
      @reset="reset"
    ></CommonSearch>
    <Table
      ref="tableRef"
      v-model:searchParams="searchData"
      :column="column"
      :show-row-selection="false"
      auto-generate-uuid
      :is-pagination="true"
      :scroll="{ y: 'auto' }"
      :is-init-get-data="false"
      url="eap/EapEqpTrace2/selectStard2"
    ></Table>
  </div>
</template>

<style lang="scss" scoped>
.get-browning-line-config-page {
  box-shadow: 0 0 10px 1px rgba(128, 128, 128, 0.2);
}
</style>
